package com.lhnstart.learn.bases.collection_.list_;

import java.util.ArrayList;
import java.util.List;

/**
 * list 常用方法
 *
 * @author lhn
 * @date 2023/10/31 20:06
 * @since 1.0.0
 **/
public class ListMethod {

    @SuppressWarnings({"all"})
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("刘备");
        list.add("张三丰");
        list.add("贾宝玉");
        System.out.println("list = " + list);
        List list1 = new ArrayList();
        list1.add("曹操");
        list1.add("刘备");
        list.addAll(list1);
        System.out.println("list = " + list);
        System.out.println(list.get(1));
        System.out.println(list.indexOf("刘备"));
        System.out.println(list.lastIndexOf("刘备"));
    }

}